import reuquest from '@/utils/request.js'

// 申请/资料
// 读取申请单详情
export const agentGetHistoryInfoApi = (data = {}, options = { loading: false }) => {
	return reuquest.post('/apiagent/v1/agent/get_apply', data, options)
}

// 申请提交
export const agentSetApplyInfoApi = (data = {}, options = { loading: false }) => {
	return reuquest.post('/apiagent/v1/agent/set_apply', data, options)
}

// 取消申请（重新申请）
export const agentCancelApplyApi = (data = {}, options = { loading: false }) => {
	return reuquest.post('/apiagent/v1/agent/cancel_apply', data, options)
}


// 产品
// 采购产品列表
export const agentProductListApi = (data = {}, options = { loading: false }) => {
	return reuquest.post('/apiagent/v1/product/selling_list', data, options)
}

// 购物车
// 列表
export const agentCartListApi = (data = {}, options = { loading: true }) => {
	return reuquest.post('/apiagent/v1/cart/list', data, options)
}

// 加入购物车/立即购买
export const agentProductAddApi = (data = {}, options = { loading: false }) => {
	return reuquest.post('/apiagent/v1/cart/add', data, options)
}

// 更新购物车商品数量
export const agentProductEditApi = (gid, data = {}, options = { loading: false }) => {
	return reuquest.post(`/apiagent/v1/cart/edit?gid=${gid}`, data, options)
}

// 移除购物车商品
export const agentProductDeleteApi = (gid, data = {}, options = { loading: false }) => {
	return reuquest.post(`/apiagent/v1/cart/delete?gid=${gid}`, data, options)
}

// 结算单/订单/支付/售后
// 采购订单
// 订单状态数据
export const agentOrderStatusDataApi = (data = {}, options = { loading: false }) => {
	return reuquest.get(`/apiagent/v1/order/order_status_data`, data, options)
}

// 结算单
export const agentOrderConfirmApi = (data = {}, options = { loading: false }) => {
	return reuquest.post(`/apiagent/v1/order/confirm`, data, options)
}

// 创建订单（提交订单）
export const agentOrderCreateApi = (data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/order/create`, data, options)
}

// 订单列表
export const agentOrderListApi = (data = {}, options = { loading: false }) => {
	return reuquest.post(`/apiagent/v1/order/list`, data, options)
}

// 订单详情
export const agentOrderDetailsApi = (gid, data = {}, options = { loading: false }) => {
	return reuquest.post(`/apiagent/v1/order/details?gid=${gid}`, data, options)
}

// 删除订单
// export const agentOrderDeleteApi = (data = {}, options = { loading: false }) => {
// 	return reuquest.post(`/apiagent/v1/order/delete?gid=${data.gid}&is_cart=${data.is_cart}`, data, options)
// }

// 提交支付（获取支付参数）
export const agentPayCreateApi = (data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/pay/create`, data, options)
}

// 确认签收（待收货的订单）
export const agentOrderVerifyApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/order/verify?gid=${gid}`, data, options)
}

// 取消订单（未进行付款的订单）
export const agentOrderCancelApi = (gid, is_cart, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/order/cancel?gid=${gid}&is_cart=${is_cart}`, data, options)
}


// 取消并删除订单（未付款/已取消/已完成的订单）
export const agentOrderDeleteApi = (gid, is_cart, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/order/delete?gid=${gid}&is_cart=${is_cart}`, data, options)
}


// 用户认证管理
// 审核状态数据
export const agentUserIdentityAuditDataApi = (data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/user_identity/audit_data`, data, options)
}

// 列表
export const agentUserIdentityListApi = (data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/user_identity/list`, data, options)
}

// 详情
export const agentUserIdentityDetailsApi = (gid, data = {}, options = { loading: false }) => {
	return reuquest.get(`/apiagent/v1/user_identity/details?gid=${gid}`, data, options)
}

// 审核
export const agentUserIdentityAuditApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/user_identity/audit?gid=${gid}`, data, options)
}


// 用户租赁单
// 订单状态数据
export const agentUserRentOrderStatusDataApi = (data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/rent_order/order_status_data`, data, options)
}

// 订单列表
export const agentUserRentOrderListApi = (data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/rent_order/list`, data, options)
}

// 订单详情
export const agentUserRentOrderDetailsApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/rent_order/details?gid=${gid}`, data, options)
}

// 确认地址（31时）
export const agentUserRentOrderComfirmAddressApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/affirm_address?gid=${gid}`, data, options)
}

// 确认日期（3时）
export const agentUserRentOrderComfirmOrderApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/affirm_order?gid=${gid}`, data, options)
}

// 确认交付（拍照留档）（5时）
export const agentUserRentOrderComfirmProductApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/affirm_product?gid=${gid}`, data, options)
}

// 确认归还（6/7时）
export const agentUserRentOrderComfirmBackApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/affirm_back?gid=${gid}`, data, options)
}

// 订单退款（have_pay_fee>0时）
export const agentUserRentOrderRefundApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/refund?gid=${gid}`, data, options)
}

// 订单删除（-1时）
export const agentUserRentOrderDeleteApi = (gid, data = {}, options = { loading: true }) => {
	return reuquest.post(`/apiagent/v1/rent_order/delete?gid=${gid}`, data, options)
}



// 仓库管理
// 仓库产品库存
// 列表
export const warehouseProductStockListApi = (data = {}, options = { loading: true }) => {
	return reuquest.get(`/apiagent/v1/warehouse_product_stock/list`, data, options)
}
